begintownscript;

variables;
short bmessage,characters,gone;
string custom_m;

body;

beginstate INIT_STATE;

	set_crime_tolerance(1);

	if(get_flag(99,4) == 1){
		split_off_one_char(11,14,0,0);
		add_char_to_party(12);
		march_party(12,14);
		force_view_center(12,14);
		set_character_facing(4,4);
		set_character_facing(0,4);
		force_instant_terrain_redraw();
		block_entry(1);
	}

	force_view_center(12,18);
	set_total_visibility(1);
	force_instant_terrain_redraw();
	pause(12);

	reset_dialog();
	add_dialog_str(0,"The house itself wasn't very big, in case you've never been there.",0);
	add_dialog_str(1,"_I have, but refresh my memory._",0);
	add_dialog_str(2,"Lots of trees.  Some herb patches where mom used to grow her favorite flowers.  It was a green place, with golden herbs, red berries, and a menagerie of colors.  There was lots of roaming room, and a deep river...",0);
	add_dialog_str(3,"_Sounds nice.  I think I remember now..._",0);
	add_dialog_str(4,"Mmm.  And then, there was my sister...  Her name was Chika.",0);
	add_dialog_choice(0,"...");
	bmessage = run_dialog(1);

	clear_buffer();
	append_char_name(0);
	append_string("...");
	get_buffer_text(custom_m);
	text_bubble_on_char(11,custom_m);
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(11,"");
	text_bubble_on_char(10,"Hey, sis.");
	set_character_facing(10,6);
	force_instant_terrain_redraw();
	pause(13);

	text_bubble_on_char(10,"");
	text_bubble_on_char(11,"You're up pretty early.");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(11,"");
	text_bubble_on_char(10,"Yeah...  You too.");
	force_instant_terrain_redraw();
	pause(13);

	text_bubble_on_char(10,"");
	text_bubble_on_char(11,"Picking flowers?");
	relocate_character(11,12,20);
	force_instant_terrain_redraw();
	pause(13);

	text_bubble_on_char(11,"");
	text_bubble_on_char(10,"Mm.  These were her favorites.");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(10,"");
	text_bubble_on_char(11,"They're beautiful.");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(11,"");
	text_bubble_on_char(10,"...");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(10,"");
	text_bubble_on_char(10,"Thanks.");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(10,"");
	text_bubble_on_char(11,"Let's go see her.");
	force_instant_terrain_redraw();
	pause(13);

	text_bubble_on_char(11,"");
	text_bubble_on_char(10,"They're not finished!");
	force_instant_terrain_redraw();
	pause(13);

	text_bubble_on_char(10,"");
	text_bubble_on_char(11,"She'll love them anyway.");
	force_instant_terrain_redraw();
	pause(15);

	reset_dialog();
	add_dialog_str(0,"_Her...  Your mother?_",0);
	if(get_flag(99,0) == 1){
		add_dialog_str(1,"Yeah.  She was sorta anal about housekeeping, but she was the best cook ever.  The soldiers who guarded the estate were all her sons.  We never went under-appreciated.  Life was good.",0);
		add_dialog_str(2,"_I know the type...  A good woman, I'm sure._",0);
		add_dialog_str(3,"Her grave...  It was to the east, across the river.  Let's follow them there.",0);
	}
	if(get_flag(99,0) == 2){
		add_dialog_str(1,"Yeah.  It's the same bland, coercive tragedy you've heard a million times before.  If you're damned sick of it, and it's understandable if you are, just say so.",0);
		add_dialog_str(2,"_That's not true, though.  Separation like that is a real pain...  Don't trivialize yourself._",0);
		add_dialog_str(3,"But parents die!  That's the nature of the game.  Why am I wasting my time telling you this?  Every tragedy is the same- mother drops dead, child goes mad and butchers some other matrons, and everything is repeated ad nauseam.  To hell with it all!",0);
		add_dialog_str(4,"_I'm sorry...  I just never thought of it that way.  But if people have to deal with this, then why do they always struggle so much?_",0);
		add_dialog_str(5,"...her grave is to the east, across the river.  Let's follow them there, shall we?",0);
	}
	add_dialog_choice(0,"...");
	bmessage = run_dialog(1);

	force_view_center(12,14);
	text_bubble_on_char(11,"");
	set_total_visibility(0);
	add_char_to_party(12);
	block_entry(1);
	set_flag(35,0,1);
	relocate_character(10,35,13);
	relocate_character(11,36,13);
	set_character_facing(10,0);
	set_character_facing(11,0);

break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;

	if(get_crime_level() > 0){
		reunite_party();
		kill_char(1000,2,0);
		end_scenario(0);
	}

break;

beginstate 10;

	message_dialog("That lever...  I never could find the key for it.  Oh well.","");
	block_entry(1);

break;

beginstate 11;

	if(get_flag(26,0) == 19 || get_flag(26,0) == 21){
		message_dialog("No...  We will be back here again soon.  But not yet.","");
		block_entry(1);
		end();
	}

	if(get_flag(26,0) < 19){
		force_view_center(37,15);
		set_total_visibility(1);
		force_instant_terrain_redraw();
		pause(10);

		reset_dialog();
		add_dialog_str(0,"_This...  I remember this place now.  Ah, the terrain was so beautiful at your house._",0);
		add_dialog_str(1,"It was always beautiful there.  Pristine.  Fresh.  Sometimes I wish that I wouldn't have left, but...  No, I had to.",0);
		add_dialog_str(2,"_But your father...  Brigadier General Aaron...  What did you think of him?_",0);
		add_dialog_str(3,"Strong.  He was very strong, and also pragmatic.  It was still good living under him, even without her...  Sometimes, it was funny to watch him keep the soldiers in shape.",0);
		add_dialog_str(4,"He loved mom very much...  The loss of her defined his existence right until the end.  I always felt sorry for Chika; dad wanted her to grow up into the woman he had lost.",0);
		add_dialog_str(5,"We prayed long and hard that she would hear us from the afterlife.  My father was a man of faith.",0);
		add_dialog_choice(0,"...");
		bmessage = run_dialog(1);

		text_bubble_on_char(13,"Son...");
		force_instant_terrain_redraw();
		pause(13);

		text_bubble_on_char(13,"");
		text_bubble_on_char(10,"What is it, dad?");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(10,"");
		text_bubble_on_char(13,"Do you believe that Sachiko,");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(13,"");
		text_bubble_on_char(13,"your mother,");
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(13,"");
		text_bubble_on_char(13,"hears our prayers?");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(13,"");
		text_bubble_on_char(10,"Mm.  Absolutely.");
		force_instant_terrain_redraw();
		pause(16);

		if(get_flag(99,0) == 2)
			message_dialog("I did not.  I had not believed in the afterlife since she had passed away.","_I...  I know what you mean.  But why didn't I know sooner...?_");

		clear_buffer();
		append_char_name(0);
		append_string(",");
		get_buffer_text(custom_m);
		text_bubble_on_char(10,"");
		text_bubble_on_char(13,custom_m);
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(13,"");
		text_bubble_on_char(13,"Do you miss mom?");
		force_instant_terrain_redraw();
		pause(16);

		text_bubble_on_char(13,"");
		text_bubble_on_char(10,"Yeah...  I do.");
		force_instant_terrain_redraw();
		pause(16);

		if(get_flag(99,0) == 1)
			message_dialog("I did not.  I loved her, but I did not want my father to feel less worthy.  I told him that I missed her.  He was insecure, and to speak openly would have insulted him.","_Oh god...  Why didn't I know sooner...?_");

		text_bubble_on_char(10,"");
		text_bubble_on_char(10,"...");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(10,"");
		text_bubble_on_char(10,"Enough of this.");
		force_instant_terrain_redraw();
		pause(16);

		reset_dialog();
		add_dialog_str(0,"_What?_",0);
		add_dialog_str(1,"Enough of this.  I must be boring you.",0);
		add_dialog_str(2,"_If you don't want to remember, then..._",0);
		add_dialog_str(3,"You were in the military back then, right?",0);
		add_dialog_str(4,"_I was...  A grunt at the time, admittedly, but..._",0);
		add_dialog_str(5,"Father was called off at Foottracer's behest.  The campaign was supposed to be 'short' and 'uneventful'.",0);
		add_dialog_choice(0,"...");
		bmessage = run_dialog(1);

		reset_dialog();
		add_dialog_str(0,"_That was the Gale Uprising, right?_",0);
		add_dialog_str(1,"The very same.  It was violent and pointless- the nephils were purposefully starved and attacked just to incite them.",0);
		add_dialog_str(2,"_Foottracer...  That swine.  Death is too benevolent of a favor for him, but in this instance, I would not hesitate to dole it out to him!_",0);
		add_dialog_str(3,"Life without father wasn't bad.  The soldiers and Chika managed to prepare decent meals, and Chika was still around...  I was not alone.",0);
		add_dialog_str(4,"But one day, when a dervish, two grunts and a priest came to our house with a sealed box and somber expressions...  My sister and I knew what had happened instantaneously.",0);
		add_dialog_str(5,"It happened at the entrance to the crops.  I still remember it clearly...  Come, Malachai.",0);
		add_dialog_choice(0,"...");
		bmessage = run_dialog(1);

		set_flag(26,0,19);
		erase_char(10);
		erase_char(11);
		erase_char(13);
		force_view_center(char_loc_x(0),char_loc_y(0));
		set_total_visibility(0);
		activate_hidden_group(3);
		set_terrain(22,32,203);
		force_instant_terrain_redraw();
		block_entry(1);
	}

	if(get_flag(26,0) == 20){

		set_total_visibility(1);
		force_view_center(37,15);
		force_instant_terrain_redraw();
		pause(15);

		reset_dialog();
		add_dialog_str(0,"I didn't bother listening to the eulogy.  I'm sure it was good, but honestly, I didn't care about his prayers.",0);
		add_dialog_str(1,"_You were too busy crying._",0);
		add_dialog_str(2,"Malachai...  Who are you?",0);
		add_dialog_str(3,"_Your hands were sweating profusely that day.  Your sister was trembling as I held her up._",0);
		add_dialog_str(4,"No.  You're lying!",0);
		add_dialog_str(5,"_It was a long time ago, but I remember..._",0);
		add_dialog_choice(0,"...");
		bmessage = run_dialog(1);

		text_bubble_on_char(16,"I remember burying him.");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(16,"");
		text_bubble_on_char(16,"I remember burying your dad.");
		force_instant_terrain_redraw();
		pause(17);

		reset_dialog();
		add_dialog_str(0,"_I remember seeing your sister's face flushed, redder than a beet.  I remember your hand gripping my leather glove with as much strength as you could muster._",0);
		add_dialog_str(1,"_I served under Aaron...  We were great friends.  We discussed a great many things...  Politics.  Morality.  And he talked about you two a lot.  Almost every day, he told me how much he missed Sachiko, Chika and you._",0);
		add_dialog_str(2,"_When I first met you, I knew that your name sounded familiar...  Your face, too, was very reminiscent.  But I thought nothing of it.  I reminded myself that you were dead.  Never in a thousand years, though, would I have imagined..._",0);
		clear_buffer();
		append_string("_");
		append_char_name(0);
		append_string(", your father was a friend.  And in case you ever feel like doubting him or yourself, I want you to know that your family's spirit is strong._");
		get_buffer_text(custom_m);
		add_dialog_str(3,custom_m,0);
		add_dialog_str(4,"Malachai...  You...  I had no idea.  Thank you, for being there.  Thank you for keeping my father company in his final moments...",0);
		add_dialog_str(5,"_Don't mention it, friend...  But Chika.  How did she, your sister, meet her fate?_",0);
		add_dialog_choice(0,"Chika...");
		bmessage = run_dialog(1);

		message_dialog("Inside.  I was inside of the house when I...  I saw it.  I saw it happen.","_You saw it?  With your own eyes?  Oh god, I am so sorry..._");

		text_bubble_on_char(16,"");
		erase_char(15);
		erase_char(16);
		erase_char(17);
		erase_char(18);
		erase_char(25);
		erase_char(26);
		force_view_center(char_loc_x(0),char_loc_y(0));
		block_entry(1);
		set_total_visibility(0);
		force_instant_terrain_redraw();
		set_flag(26,0,21);
		set_flag(35,0,0);
		set_flag(36,0,1);

	}

	if(get_flag(26,0) == 22){
		message_dialog("I wanted to stay.  Still, the soldiers were searching all over the house for me.  I had to fly.  There was no turning back for me.","");
		set_flag(26,0,23);
	}

break;

beginstate 12;

	if(get_flag(26,0) == 19){
		set_total_visibility(1);
		force_view_center(23,28);
		force_instant_terrain_redraw();
		pause(10);

		text_bubble_on_char(21,"...");
		force_instant_terrain_redraw();
		pause(9);

		clear_buffer();
		append_string("Chika and ");
		append_char_name(0);
		append_string(",");
		get_buffer_text(custom_m);
		text_bubble_on_char(21,"");
		text_bubble_on_char(19,custom_m);
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(19,"");
		text_bubble_on_char(19,"remaining relatives of");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(19,"");
		text_bubble_on_char(19,"Brigadier General Aaron,");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(19,"");
		text_bubble_on_char(19,"I regret to inform you");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(19,"");
		text_bubble_on_char(19,"that your father");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(19,"");
		text_bubble_on_char(19,"has perished.");
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(19,"");
		text_bubble_on_char(23,"Gghhh...  *sob*");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(23,"");
		text_bubble_on_char(24,"Thank you, Dervish...");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(24,"");
		text_bubble_on_char(19,"Show us the place where");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(19,"");
		text_bubble_on_char(19,"the Brigadier General");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(19,"");
		text_bubble_on_char(19,"wanted to be buried.");
		force_instant_terrain_redraw();
		pause(17);

		text_bubble_on_char(19,"");
		text_bubble_on_char(23,"Dad...");
		force_instant_terrain_redraw();
		pause(13);

		text_bubble_on_char(23,"");
		text_bubble_on_char(24,"Behind the river...  Come.");
		force_instant_terrain_redraw();
		pause(19);

		text_bubble_on_char(24,"");
		text_bubble_on_char(24,"There, there...");
		set_character_facing(24,2);
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(24,"");
		text_bubble_on_char(24,"It's okay... *sob*");
		force_instant_terrain_redraw();
		pause(17);

		reset_dialog();
		add_dialog_str(0,"Chika began crying so hard that we began to drown out each others' bawling.  Finally, both of us were alone...  Orphaned.  I can't tell you how long we both held each other, paralyzed...",0);
		add_dialog_str(1,"_I can._",0);
		add_dialog_str(2,"What?  What are you talking about?",0);
		add_dialog_str(3,"_Your father.  He was buried out back, right?  Next to your mom._",0);
		add_dialog_str(4,"What are you saying...",0);
		add_dialog_str(5,"_Come on, let's not keep him waiting._",0);
		add_dialog_choice(0,"...");
		bmessage = run_dialog(1);

		characters = 19;
		while(characters <= 24){
			erase_char(characters);

			characters = (characters + 1);
		}
		block_entry(1);
		force_view_center(char_loc_x(0),char_loc_y(0));
		set_total_visibility(0);
		activate_hidden_group(1);
		set_terrain(22,32,0);
		set_terrain(37,11,428);
		set_terrain(37,12,457);
		set_floor(37,12,76);
		force_instant_terrain_redraw();
		set_flag(26,0,20);
	}

break;

beginstate 13;

	if(get_flag(37,0) == 0){

		message_dialog("The house was lonely and quiet, as it always was.  Apart from running around outside and picking flowers, there wasn't much to do...  I thought I'd see my sister so we could talk, hold hands, and play.","Her room was through the door to the west, as was every other room in the house.");
		set_flag(37,0,1);

	}

break;

beginstate 14;

	if(get_flag(26,0) < 22){

		play_sound(111);
		pause(2);

		set_terrain(8,33,17);
		activate_hidden_group(2);
		force_instant_terrain_redraw();
		play_sound(58);
		pause(2);

		relocate_character(14,8,34);
		force_instant_terrain_redraw();
		pause(2);

		relocate_character(14,9,35);
		set_character_facing(14,6);
		force_instant_terrain_redraw();
		pause(2);

		relocate_character(14,10,35);
		force_instant_terrain_redraw();
		pause(2);

		relocate_character(14,11,35);
		force_instant_terrain_redraw();
		pause(2);

		text_bubble_on_char(28,"Chika!");
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(28,"");
		text_bubble_on_char(28,"What's wrong?");
		force_instant_terrain_redraw();
		pause(13);

		text_bubble_on_char(28,"");
		text_bubble_on_char(14,"It's...  Run!");
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(14,"");
		text_bubble_on_char(28,"What?");
		force_instant_terrain_redraw();
		pause(10);

		text_bubble_on_char(28,"");
		activate_hidden_group(4);
		put_effect_on_space(10,35,1,5,1);
		force_instant_terrain_redraw();
		run_animation_sound(10);

		message_dialog("To this day, I don't know what I saw behind her.  It was foreboding, and there was an energy to it...  I don't want to think about it much.  It was as frightful as anything I've ever seen.  I don't know how I survived.","");

		set_character_pose(27,1);
		set_character_pose(14,11);
		force_instant_terrain_redraw();
		play_sound(5);

		text_bubble_on_char(14,"Arggghh!");
		force_instant_terrain_redraw();
		pause(8);

		text_bubble_on_char(14,"");
		text_bubble_on_char(28,"Sister!  Chika!");
		force_instant_terrain_redraw();
		pause(14);

		text_bubble_on_char(28,"");
		clear_buffer();
		append_char_name(0);
		append_string("...");
		get_buffer_text(custom_m);
		text_bubble_on_char(14,custom_m);
		force_instant_terrain_redraw();
		pause(10);

		text_bubble_on_char(14,"");
		text_bubble_on_char(14,"I still love");
		force_instant_terrain_redraw();
		pause(4);

		text_bubble_on_char(14,"");
		force_instant_terrain_redraw();
		kill_char(14,2,0);

		set_character_pose(27,0);
		force_instant_terrain_redraw();
		pause(5);

		relocate_character(27,11,35);
		force_instant_terrain_redraw();
		pause(2);

		relocate_character(27,12,35);
		force_instant_terrain_redraw();
		pause(12);

		text_bubble_on_char(27,"You're next.");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(27,"");
		force_instant_terrain_redraw();
		erase_char(27);
		put_effect_on_space(12,35,1,5,1);
		force_instant_terrain_redraw();
		run_animation_sound(10);
		pause(2);

		reset_dialog();
		add_dialog_str(0,"_That's crazy...  Wait, do you think your mother was also killed in that way?_",0);
		add_dialog_str(1,"I suspect it strongly.  My father as well.  When Chika died, she had the oddest symbol on her back...  A red star.",0);
		add_dialog_str(2,"_So did your father.  A red star, as an open wound, right?_",0);
		add_dialog_str(3,"Yes...  Yes, that's correct.",0);
		add_dialog_str(4,"_But what sort of being said this to you?_",0);
		add_dialog_str(5,"I still don't remember.",0);
		add_dialog_choice(0,"...");
		bmessage = run_dialog(1);

		reset_dialog();
		add_dialog_str(0,"_And anyway, how did you end up here?  What happened when your sister died?_",0);
		add_dialog_str(1,"I was scared.  I collapsed at her side and began crying.  At that time, though, I was old enough to have slain her like that...  The wound would have invited capital punishment on me, and I knew it.",0);
		add_dialog_str(2,"I fled.  I fled out of the window, and I planned on never returning to this charnel house ever again.",0);
		add_dialog_str(3,"There was a way out of the grounds that only I knew.  It was through the thicket behind mother's grave...  I promised Chika that we would explore the woods there together, but I ended up having to crawl through the copse alone.",0);
		add_dialog_str(4,"It's easy to find if you know it's there.  It's between mother's and father's graves at the back of the grove.  Come on, I'll show you.",0);
		add_dialog_choice(0,"...");
		bmessage = run_dialog(1);

		set_flag(26,0,22);
		block_entry(1);
		erase_char(28);
		force_instant_terrain_redraw();

	}

break;

beginstate 15;

	if(get_flag(26,0) > 22){
		block_entry(1);
	}

break;

beginstate 16;

	reset_dialog();
	add_dialog_str(0,"So I went through the bushes, and made it to the town nearby.  Usually my clothes would have given me away, but they got dirty enough in the forest that I was virtually unrecognizable.",0);
	add_dialog_str(1,"The last I heard, the authorities were declaring me kidnapped and not dead.  Why I didn't turn around and go home is beyond me.",0);
	add_dialog_str(2,"_But there was no one there for you anyway._",0);
	add_dialog_str(3,"True.  Eventually, I decided that I would join the military...  Just like my father before me.  Back at square one.  I kept my name, but nobody ever figured me out, much to my relief.",0);
	add_dialog_str(4,"_And then you came here, only to serve under me..._",0);
	add_dialog_str(5,"Yeah...  That's my...  Past...  Yep...  Man, am I tired...",0);
	clear_buffer();
	append_string("Sweet dreams, ");
	append_char_name(0);
	append_string(".");
	get_buffer_text(custom_m);
	add_dialog_choice(0,custom_m);
	bmessage = run_dialog(1);
	remove_char_from_party(506);

	move_to_new_town(6,14,13);

break;

beginstate 17;

	block_entry(1);

break;

beginstate 18;

	if(get_height(char_loc_x(0),char_loc_y(0)) > 5)
		block_entry(1);

break;

